<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Title</title>
</head>
<body>
机构树
<div id="tree">

</div>
<script src="<%=request.getContextPath()%>/js/jquery-1.11.3.min.js"></script>
<script>
    function getChild(){
        $("#tree").append("<br/><button onclick='getChild()'>+</button><span>XX部门</span>");
        var url = "<%=request.getContextPath()%>/user?method=getDepChildren";//接口
        $.get(url, { depId: "100"},
            function(data){
            //渲染成树
                alert("Data Loaded: " + data)
        });
    }
    $(document).ready(function(){

             $("#tree").html("<button onclick='getChild(100)'>+</button><span>XX部门</span>");


    });
</script>
</body>
</html>